//
//  textTableViewCell.m
//  UI_wangyi
//
//  Created by dllo on 16/6/22.
//  Copyright © 2016年 HeyGirls. All rights reserved.
//

#import "textTableViewCell.h"
#import "textModel.h"
#import "GetHeightTools.h"

@interface textTableViewCell ()

@property (nonatomic, retain) UILabel *label;
@property (nonatomic, retain) UIImageView *downImageView;

@end

@implementation textTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        self.label = [[UILabel alloc] init];
        [self.contentView addSubview:_label];
        [_label release];
        
        
        self.downImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:_downImageView];
        [_downImageView release];
        
    }
    return self;
}

-(void)layoutSubviews {
    
    CGFloat labelHeight = [GetHeightTools heightWith:self.textModel.digest];
    
    self.label.frame = CGRectMake(10, 10, self.contentView.bounds.size.width, labelHeight + 20);
    // self.label.backgroundColor = [UIColor orangeColor];
    
    self.downImageView.frame = CGRectMake(0, labelHeight + 20, self.contentView.bounds.size.width, 50);
    // self.downImageView.backgroundColor = [UIColor redColor];
    
    self.label.numberOfLines = 0;
}

-(void)setTextModel:(textModel *)textModel {
    
    if (_textModel != textModel) {
        [_textModel release];
        _textModel = [textModel retain];
    }
    
    self.label.text = textModel.digest;
    
    self.downImageView.image = [UIImage imageNamed:@"down"];
    
}

@end
